package com.group4.banner.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.group4.banner.entity.Banner;
import com.group4.banner.mapper.BannerMapper;
import com.group4.banner.service.BannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 首页banner表 服务实现类
 * </p>
 *
 * @author cloud
 * @since 2022-03-10
 */
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements BannerService {
    @Autowired
    private BannerMapper bannerMapper;

    @Override
    public void addBanner(Banner banner) {
        bannerMapper.insert(banner);
    }

    @Override
    public List<Banner> getAll() {
        QueryWrapper<Banner> queryWrapper=new QueryWrapper<>();
        return bannerMapper.selectList(queryWrapper);
    }

    @Override
    public Banner fingById(String id) {
        return bannerMapper.selectById(id);
    }

    @Override
    public void deleteById(String id) {
        bannerMapper.deleteById(id);
    }
}
